package com.example.administrator.uis.view.paintView

import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.View
import com.example.administrator.uis.R

/**
 * Created by Administrator on 2017/11/14 0014.
 */
class PracticeMaskFilterView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
    var paint = Paint(Paint.ANTI_ALIAS_FLAG)

    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        setLayerType(LAYER_TYPE_SOFTWARE, null);
        var bitmap = BitmapFactory.decodeResource(resources, R.drawable.what_the_fuck)
//        var maskFilter=BlurMaskFilter(50f,BlurMaskFilter.Blur.NORMAL)
//        var maskFilter=BlurMaskFilter(50f,BlurMaskFilter.Blur.SOLID)
        var maskFilter = BlurMaskFilter(350f, BlurMaskFilter.Blur.INNER)
//        var maskFilter=BlurMaskFilter(50f,BlurMaskFilter.Blur.OUTER)
        paint.maskFilter = maskFilter
        canvas?.drawBitmap(bitmap, 100f, 100f, paint)
    }
}